<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            padding: 0;
            margin: 0;
        }
    </style>
</head>
<body>
    <div id="box" v-cloak="">
        <div style="width: 200px;margin: 0 auto;">
            <div style="height: 300px;width: 100%;background: #CCCCCC;">
                    <div v-for="i in arr">{{i | filter_all}}</div>	
            </div>
            <input type="text" v-model="no1" style="width: 100%;" @keyup.enter="btn"/>
        </div>

    </div>
    
</body>
<script src="../js/vue.js"></script>
<script>
    Vue.filter('filter_all',(a)=>{
        var arr=['操','你妈','他妈','操你妈']
        for(var i=0;i<arr.length;i++){
            if(a.indexOf(arr[i]) != -1){
                var arr1 = a.split(arr[i])
                // console.log(a.split(arr[i]));
                a =arr1.join('**')
                // console.log(arr1.json('**'));
            }
        }
        return a
    })
    new Vue({
        el:'#box',
        data:{
            no1:'',
            arr:[]
        },
        methods:{
            btn(){
                this.arr.push(this.no1)
                this.no1=''
            }
        }
    })
</script>
</html>